package lab02.test23;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

/**
 * Created by 14394 on 2017/11/10.
 */
public class Test {
    public static void main(String[] args) throws ParseException {
        //保存用户输入的生日信息
        String birthDay;
        System.out.println("please input your birthday:");
        Scanner s=new Scanner(System.in);
        birthDay=s.nextLine();

        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
        Date d= simpleDateFormat.parse(birthDay);
        long time1=0;
        long time2=0;
        Calendar cl=Calendar.getInstance();
        Calendar cl2=Calendar.getInstance();
        Date d2=new Date();
        cl.setTime(d);
        cl2.setTime(d2);
        time1= cl.getTimeInMillis();
        time2= cl2.getTimeInMillis();
        long days=(time1-time2)/(24*60*60*1000);
        System.out.println(days);
    }
}
